package com.bw.controller;

import com.bw.entity.User;
import com.bw.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class HelloController {


    @Autowired
    UserMapper userMapper;

    @RequestMapping("/list.do")
    public String list(Model model){
       List<User> list =  userMapper.list();
        model.addAttribute("list",list);
        return "list";  //   浏览器（客户端）   告诉浏览器 ，接下来去访问 add.do
    }



    @RequestMapping("/add.do")
    public String add(){

        return "add";
    }
}
